/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.willy.ratingbar;

/** TouchEventManager
 *
 * @author ljx
 * @since 2021-07-02
 */
public class TouchEventManager {
    private static TouchEventManager instance;
    /**
     * resultCallback
     */
    private TouchEventCallback resultCallback;

    /** getInstance
     *
     * @return TouchEventManager
     */
    public static synchronized TouchEventManager getInstance() {
        if (instance == null) {
            instance = new TouchEventManager();
        }
        return instance;
    }

    /** OnScanResultCallback
     *
     * @author ljx
     * @since 2021-07-02
     */
    public interface TouchEventCallback {
        /**
         * 获得触摸事件回调
         */
        void onTouch();
        /**
         * 失去触摸事件回调
         */
        void onCancel();
    }

    /**
     * 获得TouchEventCallback
     *
     * @return TouchEventCallback
     */
    public TouchEventCallback getResultCallback() {
        return resultCallback;
    }

    /**
     * 设置TouchEventCallback
     *
     * @param resultCallback TouchEventCallback
     */
    public void setResultCallback(TouchEventCallback resultCallback) {
        this.resultCallback = resultCallback;
    }
}
